home *** CD-ROM | disk | FTP | other *** search
- Path: news.spies.com!usenet
- From: Erik Max Francis <max@alcyone.com>
- Newsgroups: comp.object,comp.lang.c++,comp.ai.alife,sci.comp-aided
- Subject: Re: [Q] Growing Objects
- Date: Sun, 28 Jan 1996 18:20:18 -0800
- Organization: &tSftDotIotE
- Message-ID: <310C2EE2.8171C34@alcyone.com>
- References: <30FE8297.41C6@bme.jhu.edu> <RMARTIN.96Jan20093428@rcm.oma.com> <4ef3bo$mjo@news.jhu.edu>
- NNTP-Posting-Host: newton.alcyone.com
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 2.0b6a (X11; I; Linux 1.2.8 i486)
-
- Harold Bien wrote:
-
- > You bring up some interesting points. Though I readily see the
- > logic in your approach, I'm curious as to why my approach is
- > "incorrect."
-
- Hmm -- I never saw anyone say that your approach was incorrect.
-
- > The Run() function is the main function called and will
- > dispatch to the changing RealRun() function. However, the Run() function
- > doesn't really do much except call _OTHER_ subfuctions. Therefore,
- > should I need new methods like RespondToLight() et al. I will only have
- > to put them in the RealRun() function relevant to the state. Am I
- > overlooking something? I have yet to implement anything, but am afraid
- > of commiting myself to something which will not stand up to the test of
- > time. Thanks for your respons.
-
- The point is, unless I remember incorrectly, you're using C++, and looking for
- some functionality that will allow different functionality to be invoked on
- calling member functions to different types of cells, and you'd like these
- functions to have similar names.
-
- C++ already has this functionality, and you don't have to do anything strange
- to implement it. You declare a class (possibly abstract) in which the member
- function (Run, in this case) is virtual; in the subclasses (i.e., the
- different types of cells), you define this function differently. This type of
- application is precisely why people use C++ as opposed to C or some other
- language.
-
- --
- Erik Max Francis, &tSftDotIotE. && max@alcyone.darkside.com || max@alcyone.com
- San Jose, California, U.S.A. && 37 20 07 N 121 53 38 W && the 4th R is respect
- H.3`S,3,P,3$S,#$Q,C`Q,3,P,3$S,#$Q,3`Q,3,P,C$Q,#(Q.#`-"C`- && 1love && folasade
- Omnia quia sunt, lumina sunt. && GIGO Omega Psi && http://www.alcyone.com/max/
- "Out from his breast/his soul went to seek/the doom of the just." -- _Beowulf_
-